package com.xiaoniu.mc.hystrix;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @类描述：
 * @创建人：林继丰
 * @创建时间：2017/9/19 14:33
 * @版权：Copyright (c) 深圳市牛鼎丰科技有限公司-版权所有.
 */
public class Main {

    public static void main(String[] args) throws Exception {
        ApplicationContext ctx =
                new ClassPathXmlApplicationContext("applicationContext.xml");
        final HelloSpeaker speaker = (HelloSpeaker) ctx.getBean("helloSpeaker");
        System.out.println(speaker.speak());
        Thread.sleep(1000);
        for (int i = 0; i < 2; i++) {
            final int finalI = i;
            new Thread(new Runnable() {
                @Override
                public void run() {
                    try {
                        System.out.println(finalI + "");
                        System.out.println(speaker.speak());
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }).start();
        }


    }


}
